package com.shiyipicture.shiyipicturebackend.api.imageSearch;

import com.shiyipicture.shiyipicturebackend.api.imageSearch.model.ImageSearchResult;
import com.shiyipicture.shiyipicturebackend.api.imageSearch.sub.GetImageFirstUrlApi;
import com.shiyipicture.shiyipicturebackend.api.imageSearch.sub.GetImageListApi;
import com.shiyipicture.shiyipicturebackend.api.imageSearch.sub.GetImagePageUrlApi;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

@Slf4j
public class ImageSearchApiFacade {


  /**
   * 搜索图片
   *
   * @param imageUrl
   * @return
   */
  public static List<ImageSearchResult> searchImage(String imageUrl){
    String imagePageUrl = GetImagePageUrlApi.getImagePageUrl(imageUrl);
    String imageFirstUrl = GetImageFirstUrlApi.getImageFirstUrl(imagePageUrl);
    List<ImageSearchResult> imageList = GetImageListApi.getImageList(imageFirstUrl);
    return imageList;
  }

}
